import {Script, Word, Dictionary,OpCode} from './compiler.ts';
import * as path from 'https://deno.land/std@0.95.0/path/mod.ts';
export class RemoteDictionary implements Dictionary {
    constructor(private url:string) {
    }
    async lookup(word:string):Promise<Word|undefined> {
        const filename = path.join(this.url, word+'.forth');
        try {
            var text = await (await fetch(filename)).text();
            return new Script(text);
        } catch (e) {
            return undefined;
        }
    }
}